<?php
namespace Common\Models;
use Common\BaseModel;
class  Levels extends BaseModel
{
	public $res;
	public $expire;
	public function getSource()
    {
        return "f_levels";
    }
	public function initialize()
    {
		parent::initialize();
	}


    /**
     * @param $level_id 当前用户的等级信息
     * @func 查询下级会员等级信息
     * @return array 返回下一级用户的等级信息信息
     */
	public function level_list($level_id){
        $level_id = (int)($level_id + 1);
		if($level_id == 5){
		$level_id=4;
		}
        $level_arr = $this->findFirst(
            array(
                "conditions" => "id = ?1",
                "bind"       => array(1 => $level_id)
            )
        )->toarray();
        return $level_arr;
    }


    /**
     * 通过id查找
     */
    public function find_by_id($level_id){
        $level_info = $this->findFirstById($level_id);
        if($level_info){
            return $level_info->toarray();
        }else{
            return false;
        }
    }


}
